CREATE DATABASE SHOPPING_CART_TRY

GO

USE SHOPPING_CART_TRY

GO

CREATE TABLE Categories(
	CategoryID NVARCHAR(10) PRIMARY KEY,
	CategoryName NVARCHAR(30),
	Description NVARCHAR(50)	
)

GO

CREATE TABLE Orders
(
	OrderID NVARCHAR(10) PRIMARY KEY,
	OrderDate DATETIME,
	RequiredDate DATETIME,
	ShippAddress NVARCHAR(50)
)

GO
 
CREATE TABLE Products
(
	ProductID NVARCHAR(10) PRIMARY KEY,
	CategoryID 	NVARCHAR(10) FOREIGN KEY (CategoryID) REFERENCES Categories(CategoryID) ,
	ProductName NVARCHAR(30),
	UnitPrice FLOAT,
	QuantityPerUnit INT,
	Description NVARCHAR(50)
)

GO



CREATE TABLE OrderDetail
(
	OrderID NVARCHAR(10) FOREIGN KEY (OrderID) REFERENCES Orders(OrderID) ,
	ProductID NVARCHAR(10) FOREIGN KEY (ProductID) REFERENCES Products(ProductID),
	UnitPrice FLOAT,
	Quantity INT,
	Discount FLOAT
)

GO



CREATE TABLE AccountGroup
(
	GroupID NVARCHAR(10) PRIMARY KEY,
	GroupName NVARCHAR(50),
	GroupTitle NVARCHAR(50),
	Description NVARCHAR(50)			
)

GO

CREATE TABLE UserAccount
(
	UserAccountID NVARCHAR(10) PRIMARY KEY,
	GroupID NVARCHAR(10) FOREIGN KEY (GroupID) REFERENCES AccountGroup(GroupID),
	Username NVARCHAR(30),
	Password NVARCHAR(30),
	FirstName NVARCHAR(30),
	LastName NVARCHAR(30),
	Email NVARCHAR(30),
	Address NVARCHAR(30)		 	
)